<?php
namespace Admin\Controller;
use Think\Controller;
class LoginController extends Controller {
    public function index(){
        if (IS_POST) {
          $admin = D('admin');
            $data = $admin->create();
            if ($rt = $admin->check_login($data)) {
              session('adminid',$rt);
              $admin->save();
              $ajax = array(
                'status'=> 1,
                'text'=>'登录成功',
                'url'=> U('index/index')
              );
            }else {
              $ajax = array(
                'status'=> 0,
                'text'=>'登录失败，账户名或密码错误',
                'url'=> ''
              );
            }
            $this->ajaxReturn($ajax);
        }else {
            $this->display();
        }
    }
}
